package net.toocruel.iqismart.entity.core;

import net.toocruel.iqismart.entity.base.BaseEntity;
import net.toocruel.iqismart.entity.constants.NotificationType;
import net.toocruel.iqismart.entity.rbac.User;

import javax.persistence.*;

/**
 * @Description
 * @Auther sty
 * @createTime 2018/5/8 上午11:35
 */
@Entity
public class Notification extends BaseEntity {
    private static final long serialVersionUID = -5461486307064441617L;
    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY,optional = false)
    @JoinColumn(name = "fromUserId")
    private User fromUser;
    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY)
    private User toUser;
    @Enumerated(EnumType.ORDINAL)
    private NotificationType type;
    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY)
    @JoinColumn(name = "questionId")
    private Question question;

    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY)
    @JoinColumn(name = "commentId")
    private Comment comment;

    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY)
    @JoinColumn(name = "answerId")
    private Answer answer;

    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY)
    @JoinColumn(name = "articleId")
    private Article article;

    @Column(name = "`read`")
    private Boolean read = false;

    public Comment getComment() {
        return comment;
    }

    public void setComment(Comment comment) {
        this.comment = comment;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public User getFromUser() {
        return fromUser;
    }

    public void setFromUser(User fromUser) {
        this.fromUser = fromUser;
    }

    public User getToUser() {
        return toUser;
    }

    public void setToUser(User toUser) {
        this.toUser = toUser;
    }

    public NotificationType getType() {
        return type;
    }

    public void setType(NotificationType type) {
        this.type = type;
    }

    public Question getQuestion() {
        return question;
    }

    public void setQuestion(Question question) {
        this.question = question;
    }

    public Answer getAnswer() {
        return answer;
    }

    public void setAnswer(Answer answer) {
        this.answer = answer;
    }

    public Article getArticle() {
        return article;
    }

    public void setArticle(Article article) {
        this.article = article;
    }

    public Boolean getRead() {
        return read;
    }

    public void setRead(Boolean read) {
        this.read = read;
    }
}
